<?php
/**
 * @annotate 套餐，工作时间，学历，增删改查
 * @group   Admin/Haiyin
 * @author   mengke.yue <mengke.yue@gmail.com>
 */
class SettingAction extends BaseAction {
	protected $aVerify = array(
   	'index'
  	);//需要验证的方法
	public function menu(){
		$this->assign('Title',"套餐设置");
		$Menu = D('Menu');
		$result = $Menu->select_menu();
		$this->assign('list',$result);
		$this->display();
	}
	public function add_menu(){
		$this->assign('Title',"添加套餐");
		$url = U('Setting/menu');
   	    $this->checkPost();
   	    $data['time'] = getRequest('time');
		$data['money'] = getRequest('money');
		$data['m_name'] = getRequest('m_name');
		$data['resume_num'] = getRequest('resume_num');
		$data['job_num'] = getRequest('job_num');
		$data['refresh'] = getRequest('refresh');
		$data['stick'] = getRequest('stick');
		$data['interview'] = getRequest('interview');
		$data['diy_portal'] = getRequest('diy_portal');
		$data['wei_interview'] = getRequest('wei_interview');
		$data['wei_note'] = getRequest('wei_note');
		$data['qr_codes'] = getRequest('qr_codes');
		$data['bound_weixin'] = getRequest('bound_weixin');
		$data['custom_reply'] = getRequest('custom_reply');
		$data['custom_menu'] = getRequest('custom_menu');
		$data['guanlian_brand'] = getRequest('guanlian_brand');
		$data['add_address'] = getRequest('add_address');
		$data['one_to_one'] = getRequest('one_to_one');
		$data['specialty_service'] = getRequest('specialty_service');
		$data['data_reporting'] = getRequest('data_reporting');
		$data['remote_help'] = getRequest('remote_help');
		$data['customize_develop'] = getRequest('customize_develop');
		$data['manager'] = getRequest('manager');
		$data['copyright'] = getRequest('copyright');
		$data['campus_recruitment'] = getRequest('campus_recruitment');
		$data['events'] = getRequest('events');
		$data['ctime'] = time();
		$Menu = D('Menu');
		$result = $Menu->add_menu($data);
		
		if ($result) {
			$this->assign("jumpUrl",$url);//跳转
	        $this->success("添加成功！");
        }
	}

	public function edit_menu(){
		$this->assign('Title',"修改套餐");
		$url = U('Setting/menu');
		$Menu = D('Menu');
		$aid = getRequest('mid');
		$result = $Menu->get_menu($aid);
		$this->assign('list',$result);
   	    $this->checkPost();
   	    $data['time'] = getRequest('time');
   	    $data['money'] = getRequest('money');
		$data['m_name'] = getRequest('m_name');
		$data['resume_num'] = getRequest('resume_num');
		$data['job_num'] = getRequest('job_num');
		$data['refresh'] = getRequest('refresh');
		$data['stick'] = getRequest('stick');
		$data['interview'] = getRequest('interview');
		$data['diy_portal'] = getRequest('diy_portal');
		$data['wei_interview'] = getRequest('wei_interview');
		$data['wei_note'] = getRequest('wei_note');
		$data['qr_codes'] = getRequest('qr_codes');
		$data['bound_weixin'] = getRequest('bound_weixin');
		$data['custom_reply'] = getRequest('custom_reply');
		$data['custom_menu'] = getRequest('custom_menu');
		$data['guanlian_brand'] = getRequest('guanlian_brand');
		$data['add_address'] = getRequest('add_address');
		$data['one_to_one'] = getRequest('one_to_one');
		$data['specialty_service'] = getRequest('specialty_service');
		$data['data_reporting'] = getRequest('data_reporting');
		$data['remote_help'] = getRequest('remote_help');
		$data['customize_develop'] = getRequest('customize_develop');
		$data['manager'] = getRequest('manager');
		$data['copyright'] = getRequest('copyright');
		$data['campus_recruitment'] = getRequest('campus_recruitment');
		$data['events'] = getRequest('events');
		$data['update_time'] = time();
		$Menu = D('Menu');
		$mid = getRequest('mid');
		$result = $Menu->edit_menu($mid,$data);
		
		if ($result) {
			$this->assign("jumpUrl",$url);//跳转
        	$this->success("修改成功！");
        }
	}
	public function del_menu(){
		$id = getRequest('id');
		$da = D('Menu')->del_menu($id);
		if($da){
			$this->ajaxReturn('','success',1);
		}else{
			$this->ajaxReturn('','error',0);
		}
	}
	public function del_edu(){
		$id = getRequest('id');
		$Education = D('Education');
		$da = $Education->del_edu($id);
		if($da){
			$this->ajaxReturn('','success',1);
		}else{
			$this->ajaxReturn('','error',0);
		}
	}
	public function edu_list(){
		$this->assign('Title',"学历设置");
		$Education = D('Education');
		$result = $Education->select_edu();
		$this->assign('list',$result);
		$this->display();
	}
	public function add_edu(){
		$this->assign('Title',"添加学历");
		$this->checkPost();
		$Education = D('Education');
		$data['edu'] = getRequest('edu');
		$data['ctime'] = time();
		$result = $Education->add_edu($data);
		$url = U('Setting/edu_list');
		if ($result) {
			$this->assign("jumpUrl",$url);//跳转
	        $this->success("添加成功！");
        }
	}
	public function edit_edu(){
		$this->assign('Title',"修改学历");
		$Education = D('Education');
		$eid = getRequest('eid');
		$list = $Education->get_edu($eid);
		$this->assign('list',$list);
		$this->checkPost();
		$data['edu'] = getRequest('edu');
		$eid = getRequest('eid');
		$result = $Education->edit_edu($eid,$data);
		$url = U('Setting/edu_list');
		if ($result) {
			$this->assign("jumpUrl",$url);//跳转
	        $this->success("添加成功！");
        }
	}

	public function del_work_time(){
		$id = getRequest('id');
		$Work_time = D('Work_time');
		$da = $Work_time->del_work_time($id);
		if($da){
			$this->ajaxReturn('','success',1);
		}else{
			$this->ajaxReturn('','error',0);
		}
	}
	public function work_time_list(){
		$this->assign('Title',"学历设置");
		$Work_time = D('Work_time');
		$result = $Work_time->select_work_time();
		$this->assign('list',$result);
		$this->display();
	}
	public function add_work_time(){
		$this->assign('Title',"添加学历");
		$this->checkPost();
		$Work_time = D('Work_time');
		$data['time'] = getRequest('time');
		$data['ctime'] = time();
		$result = $Work_time->add_work_time($data);
		$url = U('Setting/work_time_list');
		if ($result) {
			$this->assign("jumpUrl",$url);//跳转
	        $this->success("添加成功！");
        }
	}
	public function edit_work_time(){
		$this->assign('Title',"修改学历");
		$Work_time = D('Work_time');
		$wid = getRequest('wid');
		$list = $Work_time->get_work_time($wid);
		$this->assign('list',$list);
		$this->checkPost();
		$data['time'] = getRequest('time');
		$wid = getRequest('wid');
		$result = $Work_time->edit_work_time($wid,$data);
		$url = U('Setting/work_time_list');
		if ($result) {
			$this->assign("jumpUrl",$url);//跳转
	        $this->success("添加成功！");
        }
	}
}
?>